package cn.bdqn.utils;

import java.util.List;

public class PageBean<T> {
	
	//最多传来2个信息,当前页数,每页显示几行.
	
	//1.当前页
	private Integer currentPage;			//页面传过来		1	2	3
	
	//2.每页显示个数
	private Integer pageSize;				//页面传过来		5	5	5
	
	//3.app信息总条数
	private Integer totalCount;				//去数据库查询
	
	//4.总页数								
	private Integer totalPage;				//totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize + 1;
	
	//5.起始索引
	private Integer startIndex;				//(currentPage - 1) * pageSize
	
	//6.app全部信息
	private List<T> pageList;

	
	
	public PageBean(Integer currentPage, Integer pageSize, Integer totalCount) {
		//当前页
		this.currentPage = currentPage != null && currentPage > 0 ? currentPage : 1;
		//每页显示个数
		this.pageSize = pageSize != null && pageSize > 0 ? pageSize : 5;
		//总条数
		this.totalCount = totalCount != null && totalCount > 0 ? totalCount : 0;
		//总页数
		this.totalPage = this.totalCount % this.pageSize == 0 ? this.totalCount / this.pageSize : this.totalCount / this.pageSize + 1;
		//起始索引
		this.startIndex = (this.currentPage - 1) * this.pageSize;
	}

	
	
	
	
	
	
	public Integer getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(Integer currentPage) {
		this.currentPage = currentPage;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(Integer totalCount) {
		this.totalCount = totalCount;
	}

	public Integer getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(Integer totalPage) {
		this.totalPage = totalPage;
	}

	public Integer getStartIndex() {
		return startIndex;
	}

	public void setStartIndex(Integer startIndex) {
		this.startIndex = startIndex;
	}

	public List<T> getPageList() {
		return pageList;
	}

	public void setPageList(List<T> pageList) {
		this.pageList = pageList;
	} 	
	
	
	
	
	
	
}
